load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load(
    "@build_bazel_rules_apple//apple:resources.bzl",
    "apple_resource_bundle",
    "apple_resource_group",
)
load("//build-system/bazel-utils:plist_fragment.bzl",
    "plist_fragment",
)

filegroup(
    name = "DrawingUIMetalResources",
    srcs = glob([
        "MetalResources/**/*.*",
    ]),
    visibility = ["//visibility:public"],
)

plist_fragment(
    name = "DrawingUIBundleInfoPlist",
    extension = "plist",
    template =
    """
    <key>CFBundleIdentifier</key>
    <string>org.telegram.DrawingUI</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>CFBundleName</key>
    <string>PremiumUI</string>
    """
)

apple_resource_bundle(
    name = "DrawingUIBundle",
    infoplists = [
        ":DrawingUIBundleInfoPlist",
    ],
    resources = [
        ":DrawingUIMetalResources",
    ],
)

filegroup(
    name = "DrawingUIResources",
    srcs = glob([
        "Resources/**/*",
    ], exclude = ["Resources/**/.*"]),
    visibility = ["//visibility:public"],
)

swift_library(
    name = "DrawingUI",
    module_name = "DrawingUI",
    srcs = glob([
		"Sources/**/*.swift",
    ]),
    copts = [
        "-warnings-as-errors",
    ],
    data = [
        ":DrawingUIBundle",
    ],
    deps = [
        "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
        "//submodules/AsyncDisplayKit:AsyncDisplayKit",
        "//submodules/Display:Display",
        "//submodules/Postbox:Postbox",
        "//submodules/TelegramCore:TelegramCore",
        "//submodules/TelegramPresentationData:TelegramPresentationData",
        "//submodules/LegacyComponents:LegacyComponents",
        "//submodules/AccountContext:AccountContext",
        "//submodules/LegacyUI:LegacyUI",
        "//submodules/AppBundle:AppBundle",
        "//submodules/TelegramStringFormatting:TelegramStringFormatting",
        "//submodules/SegmentedControlNode:SegmentedControlNode",
        "//submodules/TelegramUIPreferences:TelegramUIPreferences",
        "//submodules/PresentationDataUtils:PresentationDataUtils",
        "//submodules/HexColor:HexColor",
        "//submodules/ContextUI:ContextUI",
        "//submodules/Components/ComponentDisplayAdapters:ComponentDisplayAdapters",
        "//submodules/Components/LottieAnimationComponent:LottieAnimationComponent",
        "//submodules/Components/ViewControllerComponent:ViewControllerComponent",
        "//submodules/Components/SheetComponent:SheetComponent",
        "//submodules/Components/MultilineTextComponent:MultilineTextComponent",
        "//submodules/Components/BlurredBackgroundComponent:BlurredBackgroundComponent",
        "//submodules/AnimatedStickerNode:AnimatedStickerNode",
        "//submodules/TelegramAnimatedStickerNode:TelegramAnimatedStickerNode",
        "//submodules/StickerResources:StickerResources",
        "//submodules/ImageBlur:ImageBlur",
        "//submodules/TextFormat:TextFormat",
        "//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
        "//submodules/TelegramUI/Components/ChatEntityKeyboardInputNode:ChatEntityKeyboardInputNode",
        "//submodules/FeaturedStickersScreen:FeaturedStickersScreen",
        "//submodules/TelegramNotices:TelegramNotices",
        "//submodules/FastBlur:FastBlur",
        "//submodules/TelegramUI/Components/MediaEditor",
        "//submodules/ChatPresentationInterfaceState:ChatPresentationInterfaceState",
        "//submodules/TelegramUI/Components/LottieComponent",
        "//submodules/TelegramUI/Components/LottieComponentResourceContent",
        "//submodules/ImageTransparency",
        "//submodules/MediaPlayer:UniversalMediaPlayer",
        "//submodules/TelegramUniversalVideoContent",
        "//submodules/TelegramUI/Components/CameraButtonComponent",
        "//submodules/ReactionSelectionNode",
        "//submodules/TelegramUI/Components/EntityKeyboard",
        "//submodules/Camera",
        "//submodules/TelegramUI/Components/DustEffect",
        "//submodules/TelegramUI/Components/DynamicCornerRadiusView",
        "//submodules/TelegramUI/Components/StickerPickerScreen",
        "//submodules/TelegramUI/Components/MediaEditor/ImageObjectSeparation",
    ],
    visibility = [
        "//visibility:public",
    ],
)
